package com.aqiang.user_content.view.activity;

import android.arch.lifecycle.LifecycleOwner;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.aqiang.core.view.BaseActivity;
import com.aqiang.user_content.R;
import com.aqiang.user_content.contract.RegisterContract;
import com.aqiang.user_content.presenter.RegisterPresenter;

public class RegisterActivity extends BaseActivity<RegisterPresenter> implements RegisterContract.RegisterView {
    private EditText mEdRegisterUser;
    private EditText mEdRegisterPwd;
    private Button mBtRegister;
    @Override
    protected int bindLayout() {
        return R.layout.activity_register;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        mEdRegisterUser = (EditText) findViewById(R.id.ed_register_user);
        mEdRegisterPwd = (EditText) findViewById(R.id.ed_register_pwd);
        mBtRegister = (Button) findViewById(R.id.bt_register);

    }

    @Override
    protected void initEvent() {
        mBtRegister.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mPresenter.requestRegister();
            }
        });
    }

    @Override
    protected void createPresenter() {
        mPresenter = new RegisterPresenter(this);
    }

    @Override
    protected void initData() {

    }


    @Override
    public void succse() {
        showToast("成功");
    }

    @Override
    public String getUser() {
        return mEdRegisterUser.getText().toString().trim();
    }

    @Override
    public String getPwd() {
        return mEdRegisterPwd.getText().toString().trim();
    }

    @Override
    public LifecycleOwner getLifecycleOwner() {
        return this;
    }
}
